//
//  ChooseCommonCarCell.m
//  CarUser
//
//  Created by 王森林 on 2018/12/11.
//  Copyright © 2018年 王森林. All rights reserved.
//

#import "ChooseCommonCarCell.h"

@interface ChooseCommonCarCell()
@property (nonatomic, strong) UIImageView *logoImageView;
@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation ChooseCommonCarCell



//- (void)createUI
//{
//    [self.contentView addSubview:self.logoImageView];
//    [self.contentView addSubview:self.titleLabel];
//    [self createConstraint];
//    [self showSeparatorWithY:59.5];
//}

- (void)createUIWithData
{
    [self.contentView  removeAllSubviews];
    [self.contentView addSubview:self.logoImageView];
    [self.contentView addSubview:self.titleLabel];
    [self createConstraint];
    [self showSeparatorWithY:59.5];
    
}

-(void)createConstraint
{
    
    [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(21);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
    
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.logoImageView.mas_right).offset(18);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
        make.height.mas_equalTo(18);
    }];
    
   
    
}



- (void)setImageWithName:(NSString *)imageName withTitle:(NSString *)title
{
    [self createUIWithData];
//    self.logoImageView.image = IMG(imageName);
    [self.logoImageView sd_setImageWithURL:[NSURL URLWithString:APPEND_URL(BASE_URL, imageName)]];
    self.titleLabel.text = title;
    
}

- (UIImageView  *)logoImageView
{
    if (!_logoImageView) {
        _logoImageView = [UIImageView new];
    }
    return _logoImageView;
    
}

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.textColor = RGB(40, 40, 40);
        _titleLabel.font = FONT_SIZE(12);
    }
    return _titleLabel;
}

@end
